<?php
        global $Room;
        $id=$connection->user['room'];
        $connection->user['zt']=1;
        $Room[$id]['user'][$connection->user['id']]->user['zt']=1;

     //    $msg=array();
     //    $msg['id']='operationButton';
     //    $msg['html']='<div class="operationButton-2-zt">
     //  <img id="zbs" class="operationButton-2" src="/app/img/bull9/ready.png" style="display:block;">
     // </div>';
     //    act('html',$msg,$connection);

        $zbsl=0;
        $zrs=0;
        foreach ($Room[$id]['user'] as $connection3) {
             if($connection3->user['online']=='-1' && $Room[$id]['xx']['zt']<2){
                    $Room[$id]['user'][$connection3->user['id']]->user['zt']=0;
             }
            if($connection3->user['zt']=='1'){
                $zbsl=$zbsl+1;
            }
            if($connection3->user['online']=='1'){
                $zrs=$zrs+1;
            }
            if($connection3->user['online']!='-1'){
                $msg=$connection->user['index'];
                act('zbuser',$msg,$connection3);
            }
        }

        if($zrs==$zbsl && $zrs>=2){
                $data=array();
                $Room[$id]['time1']=time();
                $data['act']='startroom';
                $data['room']=$id;
                reqact($data,'');
                return false;
        }
        echo $zbsl;
        echo $Room[$id]['xx']['zt'];
        if($zbsl>=2 && $Room[$id]['xx']['zt']==0){
                $Room[$id]['xx']['zt']=1;
                if($zrs==$zbsl){
                  $time_interval = 0;
                }
                else{
                  $time_interval = 10;
                }
                if($Room[$id]['xx']['js']=='0'){
                    $time_interval = 30;
                }
                
                $Room[$id]['time']=time()+$time_interval;
                
                djs($time_interval,'startroom',$id);

                foreach ($Room[$id]['user'] as $connection3) {
                    if($connection3->user['online']!='-1'){
                        //act('mp3play','mp3kaiju',$connection3);
                        act('djs',$Room[$id]['time'],$connection3);
                        $msg=array();
                        $msg['id']='divRobBankerText';
                        $msg['html']='<p class="liurenniuniu-ziti">准备开始</p>';
                        act('html',$msg,$connection3);
                    }
                }
        }


